
<div class="art-post">
    <div class="art-post-tl"></div>
    <div class="art-post-tr"></div>
    <div class="art-post-bl"></div>
    <div class="art-post-br"></div>
    <div class="art-post-tc"></div>
    <div class="art-post-bc"></div>
    <div class="art-post-cl"></div>
    <div class="art-post-cr"></div>
    <div class="art-post-cc"></div>
    <div class="art-post-body">
        <div class="art-post-inner art-article">
            <h2 class="art-postheader">[Thông tin quảng cáo]</h2>
<?php
if(isset($has_error))
{
?>
<ul>
    <?php
foreach($errors as $error)
{
echo "<span class='error-notification'>* $error</span><br/>";
    }
    ?>
</ul>
<?php
}

if(isset($message))
{
echo "<span class='message-notification'>* $message</span><br />";
}
?>
<form action="<?php echo Utility::getSiteUrl();?>/ads/<?php if($action == 'edit') echo "edit/$id"; else echo 'add';?>" method="post">

<table class="">
	<tr>
		<td>Tên quảng cáo</td>
		<td><input type="text" name="name" value="<?php if(isset($input)) echo ($action=='edit'?$input->name:$input['name']);?>"/></td>
	</tr>
	<tr>
		<td>Mô tả</td>
		<td><textarea name="description" cols="30" rows=""><?php if(isset($input))  echo ($action=='edit'?$input->description:$input['description']);?></textarea></td>
	</tr>
    <?php
        $size = $partner_list->getsize();
        $selected = 0;
        if(isset($input))
            $selected = ($action == 'add')?$input['partner_id']:$input->partner_id;
    ?>
    <tr>
        <td>Đối tác</td>
        <td>
            <select name="partner_id">
                <option value="0">Chọn đối tác</option>
                <?php
                for($i = 0;$i < $size;$i++)
                {
                    $row = $partner_list->getRow($i);
                    ?>
                <option value="<?php echo $row->id; ?>" <?php if($selected == $row->id) echo "selected='selected'"; ?>><?php echo $row->name; ?></option>
                    <?php
                }
                ?>
            </select>
        </td>
    </tr>
	<tr>
		<td>Đường dẫn ảnh</td>
		<td><input type="text" name="image" value="<?php if(isset($input)) echo ($action=='edit'?$input->image:$input['image']);?>"/><input
                        type="button" value="thêm ảnh"
                        onclick="window.open('<?php echo Utility::getSiteUrl(); ?>/upload ','Upload','menubar=no,width=750,height=500,toolbar=no')"/></td>
	</tr>
	<tr>
		<td>Liên kết ngoài</td>
		<td><input type="text" name="link" value="<?php if(isset($input)) echo ($action=='edit'?$input->link:$input['link']);?>"/></td>
	</tr>
	<tr>
		<td></td>
		<td>
            <input type="submit" value="<?php echo ($action == 'add')?'Thêm':'Sửa';?> quảng cáo" />
            <input type="reset" value="Nhập lại"/>
            <input type="button" value="Quay lại danh sách" onclick="window.location='<?php echo Utility::getSiteUrl();?>/ads'" />
        </td>
	</tr>
</table>

</form>
        </div>

        <div class="cleared"></div>
    </div>
</div>